///////////////////////////////////////////////////////////
//  BoolData.cpp
//  Implementation of the Class BoolData
//  Created on:      18-Aug-2013 10:40:54 PM
//  Original author: Jakkaphan Aiemcharoenjit
///////////////////////////////////////////////////////////

#include "BoolData.h"
#include "DataSchemaXML.h"

using namespace Data;

BoolData::BoolData(const bool& _value)
{
  this->m_type = IObject::DATA_T;
  this->m_dataType = IData::BOOL_T;
  this->m_value = _value;
}


BoolData::BoolData(const BoolData& anotherBool)
{
  this->m_type = IObject::DATA_T;
  this->m_dataType = IData::BOOL_T;
  this->m_value = anotherBool.m_value;
}


BoolData::~BoolData()
{

}


IData::DataType BoolData::GetDataType() const 
{

	return this->m_dataType;
}


IObject::ObjectType BoolData::GetType() const 
{

	return this->m_type;
}


bool BoolData::GetValue() const 
{

	return this->m_value;
}


void BoolData::SetValue(const bool& _value)
{
  this->m_value = _value;
}


IObject* BoolData::Clone()
{
  BoolData* cloneData = new BoolData(*this);
	return cloneData;
}


String_t BoolData::ToString() const 
{
  //String_t result = L"value = ";
  //result += this->m_value ? L"TRUE" : L"FALSE";
  //result += L"\n";
	//return result;
  return this->m_value ? _T("TRUE") : _T("FALSE");
}


String_t BoolData::ToXML()
{
  //<UseInteger>TRUE</UseInterger>
  String_t xml = _T("<") + DataSchemaXML::BOOLDATA_ELEMENT + _T(">");
  xml += this->m_value ? _T("TRUE") : _T("FALSE");
  xml += _T("</") + DataSchemaXML::BOOLDATA_ELEMENT + _T(">");
  return  xml;
}

bool BoolData::operator==( const bool& _anotherValue ) const
{
  return this->m_value == _anotherValue;
}

bool BoolData::operator!=( const bool& _anotherValue ) const
{
  return this->m_value != _anotherValue;
}
